package com.fuchuang.seckillsystem.mapper;

import com.fuchuang.seckillsystem.entity.Activity;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface ActivityMapper {
    
    int insertSelective(Activity record);
    
    Activity selectByPrimaryKey(@Param("id") Integer id);
    
    int updateByPrimaryKeySelective(Activity record);
    
    
    List<Activity> selectActivityByDate(@Param("beforeDate") Date beforeDate, @Param("laterDate") Date laterDate);
    
    List<Activity> selectAllActivity();
    
    void insertActivityGoods(@Param("activityId") Integer activityId, @Param("goodsIds") List<Integer> goodsIds);
    
    void deleteActivityGoods(@Param("activityId") Integer activityId, @Param("goodsIds") List<Integer> goodsIds);
    
    /**
     * 查询开始时间在指定时间内的秒杀活动
     *
     * @param goodsId
     * @return
     */
    List<Activity> selectActivityByGoodsId(@Param("goodsId") Integer goodsId);
    
    /**
     * 查询预加载的秒杀活动
     */
    List<Activity> selectPreloadingActivity(@Param("laterDate") Date laterDate, @Param("currentDate") Date currentDate, @Param("isSeckill") Boolean isSeckill);
    
}